<!DOCTYPE html>
<html>
<head>
    <title>搜索结果</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no, maximum-scale=1.0"/>
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link href="{G_TEMPLATES_CSS}/wx/style.css" rel="stylesheet">
     <link href="{G_TEMPLATES_CSS}/wx/comm.css" rel="stylesheet">
    <script src="{G_TEMPLATES_JS}/wx/jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src='{G_TEMPLATES_JS}/wx/jquery-ui.min.js'></script>
    <style>
        body{
            background-color:#F3F3F3;
        }
        .name{
            margin-left:0px;
            float:left;
            width:60%;
            text-align:center;
        }
        .shaidan-back{
            width:40px;
            height:40px;
            margin-top:10px;
        }
        .header-left{
            width:20%;
            height:100%;
            float:left;
        }
        .header-right{
            width:20%;
            height:100%;
            float:left;
        }
    </style>
</head>
<script>
$(document).ready(function(e) {
    var len=$(".search-goods-list li").length;
    var out=$(".search-bar-out").width();
    for(var i=0;i<len;i++)
    {
        var sy=$(".search-goods-sy").eq(i).text();
        var syNum=parseInt(sy.replace("剩余：",""));
        var zx=$(".search-goods-zx").eq(i).text();
        var zxNum=parseInt(zx.replace("总需：",""));
        var ra=(zxNum-syNum)/zxNum;
        var w=out*ra;
        $(".search-bar-in").eq(i).width(w);
    }
});
</script>
<body>
    <header class="header">
        <a href="javascript:;" onClick="history.go(-1)">
        <div class="header-left">
            <img src="{G_TEMPLATES_IMAGE}/wx/back-b.png" class="shaidan-back">
        </div>
        </a>
        <span class="name">{wc:$search}的搜索结果</span>
        <div class="header-right">
        </div>
    </header>
    
     <div class="search-goods-list">
        <ul>
        {wc:if $shoplist!=null} 
        {wc:loop $shoplist $shop}
            <li>
                <img src="{G_UPLOAD_PATH}/{wc:$shop['thumb']}" alt="{wc:$shop['title']}" class="search-goods-img"><br />
                <span class="search-goods-name">{wc:$shop['title']}</span>
                <div class="search-bar-out"><div class="search-bar-in"></div></div>
                <div class="search-goods-num">
                    <span class="search-goods-zx">总需：{wc:$shop['zongrenshu']}</span>
                    <span class="search-goods-sy">剩余：{wc:$shop['zongrenshu']-$shop['canyurenshu']}</span>
                </div><br />
                <span class="search-pay-go">立即购买</span>
                <img src="{G_TEMPLATES_IMAGE}/wx/add-cart.png" class="search-add-gwc">
            </li>
        {wc:loop:end}
        {wc:else}
        <li>
             <span class="search-goods-name">未找到有关“<em class="orange">{wc:$search}</em>”的商品/span>
        </li>
        {wc:if:end}  
           
      </div>
      
     {wc:templates "mobile/index","footer"}   
    
<!--加入购物车-->
<script type="text/javascript">
$('.search-add-gwc').on('click', function () {
    var cart = $('.shopping-cart');
    var imgtodrag = $(this).parent('.search-goods-list ul li').find('img').eq(0);
    if (imgtodrag) {
        var imgclone = imgtodrag.clone().offset({
            top: imgtodrag.offset().top,
            left: imgtodrag.offset().left
        }).css({
            'opacity': '0.5',
            'position': 'absolute',
            'height': '150px',
            'width': '150px',
            'z-index': '100'
        }).appendTo($('body')).animate({
            'top': cart.offset().top + 10,
            'left': cart.offset().left + 10,
            'width': 75,
            'height': 75
        }, 1000, 'easeInOutExpo');
        setTimeout(function () {
            cart.effect('shake', { times: 2 }, 200);
        }, 1500);
        imgclone.animate({
            'width': 0,
            'height': 0,
        }, function () {
            $(this).detach();
        });
    }
});
</script>
</body>
</html>
